package org.sakila.service;

import org.sakila.entities.CommonResult;
import org.sakila.entities.Film;
import org.sakila.service.impl.SakilaFallbackService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Component // 记得加到spring容器中
//服务端配置的服务名, 失败会调用PaymentFallbackService.class的同名方法
@FeignClient(value = "sakila-cloud-provider",fallback = SakilaFallbackService.class)
public interface SakilaFeignService {
    //使用feign就可以向调用controller一样远程调用服务
    @GetMapping("/film/get/{id}")
    CommonResult<Film> getFilmById(@PathVariable("id") Long id);
    @GetMapping("/film/getFilms/{start}/{size}")
    CommonResult<?> getFilms(@PathVariable("start") Integer start, @PathVariable("size") Integer size);
}
